package com.example.f8399.testdemo.activity;

import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.example.f8399.testdemo.BaseActivity;
import com.example.f8399.testdemo.R;
import com.example.f8399.testdemo.adapter.ExpandListAdapter2;
import com.example.f8399.testdemo.bean.ItemLvOne;
import com.example.f8399.testdemo.bean.ItemLvTwo;
import com.example.f8399.testdemo.databinding.ActivityBaseQuicklyAdapterBinding;

import java.util.ArrayList;
import java.util.List;

public class BaseQuicklyAdapterActivity extends BaseActivity {

    ActivityBaseQuicklyAdapterBinding mBinding;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = DataBindingUtil.setContentView(this,R.layout.activity_base_quickly_adapter);

        initView();
    }

    private void initView() {
        LinearLayoutManager layout = new LinearLayoutManager(this);
        mBinding.recyclerView.setLayoutManager(layout);
        mBinding.recyclerView.addItemDecoration(new DividerItemDecoration(this,layout.getOrientation()));
        List<MultiItemEntity> list = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            ItemLvOne itemLvOne = new ItemLvOne();
            itemLvOne.setTitle("title ->"+i);
            for (int i1 = 0; i1 < 4; i1++) {
                ItemLvTwo itemLvTwo = new ItemLvTwo();
                itemLvTwo.setName("Li -"+i1);
                itemLvOne.addSubItem(itemLvTwo);
            }
            list.add(itemLvOne);
        }
        ExpandListAdapter2 adapter = new ExpandListAdapter2(this,list);
        mBinding.recyclerView.setAdapter(adapter);
        adapter.expandAll();
    }



}
